<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link href="../css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="../css/setting.css" />
</head>

<body class="gray">
	<div class="mui-content">
		<div class="feed text">
			<textarea name="" id="txt" placeholder="请写下您的宝贵意见或是使用体验"></textarea>
			<p style="text-align: right;padding-right: 10px;" id="len">500</p>
		</div>	    
		<div class="inpt">
			<input type="text" id="mobile" name="" placeholder="请输入您的手机号/邮箱" />
		</div>
		
		<div class="mui-content-padded" style="padding-top: 20px;">
	   		<button type="button" class="bexta-btn bexta-btn-red mui-btn mui-btn-block enter">提交</button>
	   </div>
		
	</div>
<script src="../js/mui.js"></script>
<script src="../js/bexta.js"></script>
<script type="text/javascript">
	mui.init()
	mui.plusReady(function () {
		var lens = document.querySelector('#len');
	   document.querySelector('#txt').addEventListener('keypress', function(){
	   		var vlen = this.value.length;
	   		if( vlen > 500 ){
	   			this.value = this.value.substring(0, 500);
	   		}
	   		lens.innerHTML = 500-(vlen+1);
	   });
	   document.querySelector('.enter').addEventListener('tap', function(){
	   		var mobi = document.querySelector('#mobile').value;
	   		var txt = document.querySelector('#txt').value;
	   		console.log( check.phone(mobi) )
	   		if( !check.phone(mobi) || txt == '' ){
	   			mui.toast("请输入完整");
	   			return ;
	   		}else{
	   			bexta.ajax(api.suggest, function(res,msg){
		   			mui.toast(msg);
		   			mui.back();
		   		},{data:{mobile:mobi, content:txt, uid:bexta.getStorage(USER).uid}});
	   		}
	   });
	});
</script>
</body>
</html>